
public class P4 {
	public static void main(String[] args) {
		int max = 0;
		
		for (int i = 100; i < 1000; i++) {
			for (int j = 100; j < 1000; j++) {
				int x = i * j;
				StringBuffer a = new StringBuffer(String.valueOf(x));
				StringBuffer b = new StringBuffer(String.valueOf(x));
				
				if (a.toString().equals(b.reverse().toString())) {					
					if (max < x) {
						max = x;
					}
				}
			}
		}
		
		System.out.println(max);
	}
}
